<template>
  <div class="le-1">
    <div class="top-1">
      <div class="top-12" v-for="(item, index) in arr" :key="index">
        <el-badge :value="2" class="item" type="warning">
          <div class="icon-1">
            <i :class="['iconfont', item.icon]"></i>
          </div>
        </el-badge>
        <div class="text-1">{{ item.name }}</div>
      </div>
    </div>
    <div class="details">
      <div class="details-1" v-for="(item, index) in arr1" :key="index">
        <div class="de-1">
          <img :src="item.img" class="img" />
          <span>{{ item.name }}</span>
        </div>
        <div class="texsa-1">
          <img
            :src="item.img1"
            class="imgs"
            @click="shonS(index)"
            v-if="flag"
          />
          <div @click="shonS1(index)">
            <span>{{ item.sum }}</span>
            <span>{{ item.text }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import img1 from '@/assets/tupiao/y-1.png'
import img2 from '@/assets/tupiao/y-2.png'
import img3 from '@/assets/tupiao/y-3.png'
import img4 from '@/assets/tupiao/y-4.png'
const arr = [
  {
    name: '我的任务',
    icon: 'icon-youjian'
  },
  {
    name: '我的申请',
    icon: 'icon-youjian'
  },
  {
    name: '我的提醒',
    icon: 'icon-wodetixing'
  }
]
const arr1 = [
  {
    name: '一卡通余额',
    img: img1,
    sum: '',
    text: '',
    img1: img4
  },
  {
    name: '图书借阅',
    img: img2,
    sum: 0,
    text: '本'
  },
  {
    name: '个人邮件',
    img: img3,
    text: '待激活'
  },
  {
    name: '公共邮件',
    img: img3,
    text: '未绑定'
  },
  {
    name: '一平台流程',
    img: img2,
    sum: 0,
    text: '条'
  }
]
const flag = ref(true)
const shonS = (index: number) => {
  flag.value = !flag.value
  arr1.forEach((item, i) => {
    if (i === index) {
      item.sum = '112'
      item.text = '元'
    }
  })
}
const shonS1 = (index: number) => {
  flag.value = !flag.value
  arr1.forEach((item, i) => {
    if (i === index) {
      item.sum = ''
      item.text = ''
    }
  })
}
</script>

<style lang="scss" scoped>
.le-1 {
  width: 300px;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
}
.top-1 {
  width: 100%;
  height: 90px;
  padding: 10px;
  box-sizing: border-box;
  background: #197bc6;
  display: flex;
  justify-content: space-between;
}
.details {
  width: 100%;
  height: 290px;
  padding: 10px;
  box-sizing: border-box;
  background: #f5f8fc;
  .details-1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 45px;
    .de-1 {
      display: flex;
      align-items: center;
      .img {
        margin-right: 5px;
      }
    }
  }
}
.icon-1 {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #197bc6;
  border: 1px solid #fff;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
}
.iconfont {
  font-size: 30px;
  color: #fff;
}
.top-12 {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.text-1 {
  color: #fff;
  font-size: 12px;
}
.imgs {
  width: 44px;
  height: auto;
}
.texsa-1 {
  display: flex;
}
</style>
